import { defineStore } from "pinia";

const store = defineStore("indexStore", {
  state: () => {
    return {
      name: "zr",
    };
  },
  actions: {
    setName(val: string) {
      this.name = val;
    },
    validityEmail(val: string):boolean{
      return /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(val)
    },
    validityPhone(val: string):boolean{
      return /^1[3-9]\d{9}$|^17[0-28]\d{8}$/.test(val)
    },
  },
});

export default store;
